import type { ProColumns } from '@ant-design/pro-table';

// 定义请求返回数据类型
export type ColumnsItem = {
  seqNo: number;
  outAcNme: string;
  outAcNo: string;
  inAcNme: number;
  inAcNo: string;
  txAmt: number;
  txNo: string;
  txDte: Date;
  txStatus: string;
  remarks: string;
}

// 定义表头
let columnsData: ProColumns<ColumnsItem>[] = [
  {
    title: '付款账户名',
    dataIndex: 'memNoIn',
    hideInTable: true,
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '收款账户名',
    hideInTable: true,
    dataIndex: 'memNoOut',
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '交易流水',
    dataIndex: 'txNo',
    hideInTable: true,
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '交易结果',
    dataIndex: 'transResult',
    hideInTable: true,
    valueType: 'select',
    valueEnum: {
      0: { text: '成功', status: 'Success' },
      1: { text: '失败', status: 'Failure ' },
    },
  },
  {
    title: '交易日期',
    dataIndex: 'created_at',
    hideInTable: true,
    valueType: 'dateRange',
    search: {
      transform: (value) => {
        return {
          startTime: value[0],
          endTime: value[1],
        };
      },
    },
  },

  // 上方查询，下方表头
  {
    title: '付款账户名',
    width: 120,
    fixed: 'left',
    hideInSearch: true,
    dataIndex: 'outAcNme',
    ellipsis: true,
  },
  {
    title: '付款账号',
    width: 160,
    hideInSearch: true,
    dataIndex: 'outAcNo',
  },
  {
    title: '收款账户名',
    width: 120,
    hideInSearch: true,
    dataIndex: 'inAcNme',
    ellipsis: true,
  },
  {
    title: '收款账号',
    width: 160,
    hideInSearch: true,
    dataIndex: 'inAcNo',
  },
  {
    title: '转账金额',
    hideInSearch: true,
    dataIndex: 'txAmt1',
    width: 120,
  },
  {
    title: '币种',
    width: 50,
    hideInSearch: true,
    dataIndex: 'ccy1',
  },
  {
    title: '出账金额',
    hideInSearch: true,
    dataIndex: 'txAmt2',
    width: 120,
  },
  {
    title: '币种',
    width: 50,
    hideInSearch: true,
    dataIndex: 'ccy2',
  },
  {
    title: '到账金额',
    hideInSearch: true,
    dataIndex: 'txAmt3',
    width: 120,
  },
  {
    title: '币种',
    width: 50,
    hideInSearch: true,
    dataIndex: 'ccy3',
  },
  {
    title: '交易流水号',
    width: 180,
    hideInSearch: true,
    dataIndex: 'txNo',
  },
  {
    title: '交易时间',
    width: 160,
    hideInSearch: true,
    dataIndex: 'txTm',
    valueType: 'dateTime',
  },
  {
    title: '交易结果',
    width: 100,
    hideInSearch: true,
    dataIndex: 'txStatus',
    valueEnum: {
      0: { text: '成功', status: 'Success' },
      1: { text: '失败', status: 'Error' },
    },
  },
  {
    title: '失败原因',
    width: 200,
    dataIndex: 'remarks',
    hideInSearch: true,
  }
]
export default columnsData;
